﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Collections.ObjectModel;

namespace bdnt_pets_system.Tools
{
    public class DgPageView
    {
        public static PagedCollectionView GetPCV(int totalCount, int pageSize)
        {
            ObservableCollection<int> list = new ObservableCollection<int>();
            int last = totalCount % pageSize;
            int count = 0;
            if (last > 0)
                count = totalCount / pageSize + 1;
            else
                count = totalCount / pageSize;
            for (int i = 0; i < count; i++)
            {
                list.Add(i);
            }
            PagedCollectionView pcv = new PagedCollectionView(list);
            return pcv;
            //dpPage.Source = pcv;
            //dpPage.PageSize = 1;
            //dpPage.PageIndex = list.Count > 0 ? 0 : -1;
        }
    }
}
